﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Library;

namespace QLKH.PopUp.DiaLy
{
    public partial class popThemTinh : Form
    {
        public popThemTinh()
        {
            InitializeComponent();
        }

        private void popThemTinh_Load(object sender, EventArgs e)
        {
            
        }

        public delegate void ThemTinh(int outid);

        public ThemTinh MyFuntion;

        private void btsave_Click(object sender, EventArgs e)
        {
            if (MyFuntion != null)
            {
                string tentinh = cbbTentinh.Text.Trim();
                Int16 vitri = Int16.Parse((txtVitri.Text.Trim()== "") ? "0" : txtVitri.Text.Trim());
                Int16 hienthi = Int16.Parse((checkHienthi.Checked) ? "1" : "0");
                string tenkhongdau = Querys.LocDau(cbbTentinh.Text.Trim()).ToLower();

                clTTP adv = new clTTP();
                int outid = adv.add(tentinh, vitri, hienthi,tenkhongdau);
                MyFuntion(outid);
            }
            this.Close();
        }

        private void btquit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
